package com.jeesite.modules.digitalize.constants;

import java.util.Arrays;

public enum OperationEnum {
    UP("up", "向上移动"),
    DOWN("down", "向下移动"),
    LEFT("left", "向左移动"),
    RIGHT("right", "向右移动"),
    PLAN_START("plan_start_date", "计划开始时间"),
    PLAN_END("plan_end_date", "计划结束时间"),
    START("start_date", "实际开始时间"),
    END("end_date", "实际结束时间");
    ;

    public static final String info = "up 向上移动 down 向下移动 left 向左移动 right 向右移动" +
            "plan_start_date 计划开始时间 plan_end_date 计划结束时间 start_date 实际开始时间 end_date 实际结束时间";
    private final String command;
    private final String description;

    OperationEnum(String command, String description) {
        this.command = command;
        this.description = description;
    }

    public String getCommand() {
        return command;
    }

    public String getDescription() {
        return description;
    }

    public static OperationEnum getByCommand(String command) {
        if (command != null) {
            return Arrays.stream(OperationEnum.values())
                    .filter(item -> item.command.equals(command))
                    .findFirst()
                    .orElse(null);
        }
        return null;
    }
}
